package com.aoxin.controller.attendance;

import java.util.List;
import java.util.Map;

import com.aoxin.model.attend.QueryRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.aoxin.model.attendance.SlfAttendance;
import com.aoxin.service.inter.attendance.AttendanceService;
import com.aoxin.util.AjaxRes;
import com.aoxin.util.Const;

/**
 * 考勤记录Controller
 * 
 * @author Melody
 * @date 2018年3月28日 下午4:14:44
 */
@RestController
@RequestMapping("/web/attendance")
public class AttendanceController {

	@Autowired
	private AttendanceService attendanceService;

	/**
	 * 添加考勤记录
	 * @param aseChildrenId
	 *            考勤记录
	 */
	@RequestMapping("/insertAttendance")
	public AjaxRes insertAttendance(String aseChildrenId, AjaxRes ajaxRes) {
		try {
			this.attendanceService.insertAttendance(aseChildrenId);
			ajaxRes.setSucceedMsg(Const.SAVE_SUCCEED);
		} catch (Exception e) {
			ajaxRes.setFailMsg(e.getMessage());
		}
		return ajaxRes;
	}
	/**
	 * 查询考勤记录
	 * @param queryRecord
	 * @return
	 */
	@RequestMapping("/getRecord")
	public AjaxRes getRecord(QueryRecord queryRecord, AjaxRes ajaxRes) {
		try {
			List<QueryRecord> record = this.attendanceService.getRecord(queryRecord);
			ajaxRes.setSucceed(record,Const.SAVE_SUCCEED);
		} catch (Exception e) {
			ajaxRes.setFailMsg(e.getMessage());
		}
		return ajaxRes;
	}

}
